package com.suiyun.EventBusDemo.sync.controller;

import com.suiyun.EventBusDemo.sync.event.DemoEvent;
import com.suiyun.EventBusDemo.sync.handler.EventHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ww
 * @date 2020/10/29 下午2:27
 */
@Slf4j
@RestController
public class EventBusController {

    @Autowired
    private EventHandler eventHandler;

    @GetMapping("/eventBus")
    public String eventBus(){
        DemoEvent demoEvent = new DemoEvent();
        demoEvent.setName("eventBus");

        eventHandler.eventPost(demoEvent);
        log.info("-----> 发送同步");
        return "success";
    }
}
